*
* GtkFlowBox uses a single CSS node with name flowbox. GtkFlowBoxChild
* uses a single CSS node with name flowboxchild.
+ * For rubberband selection, a subnode with name rubberband is used.
*/
#include <config.h>
#include "gtkintl.h"
#include "gtkcssnodeprivate.h"
#include "gtkwidgetprivate.h"
+#include "gtkstylecontextprivate.h"
#include "a11y/gtkflowboxaccessibleprivate.h"
#include "a11y/gtkflowboxchildaccessible.h"
GtkGesture *multipress_gesture;
GtkGesture *drag_gesture;
- gboolean rubberband_select;
GtkFlowBoxChild *rubberband_first;
GtkFlowBoxChild *rubberband_last;
+ GtkCssNode *rubberband_node;
+ gboolean rubberband_select;
gboolean rubberband_modify;
gboolean rubberband_extend;
cairo_save (cr);
context = gtk_widget_get_style_context (widget);
- gtk_style_context_save (context);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_RUBBERBAND);
+ gtk_style_context_save_to_node (context, priv->rubberband_node);
iter1 = CHILD_PRIV (priv->rubberband_first)->iter;
iter2 = CHILD_PRIV (priv->rubberband_last)->iter;
cairo_append_path (cr, path);
cairo_path_destroy (path);
- state = gtk_widget_get_state_flags (widget);
+ state = gtk_style_context_get_state (context);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_style_context_get_border_color (context, state, &border_color);
G_GNUC_END_IGNORE_DEPRECATIONS
GtkFlowBoxPrivate *priv = BOX_PRIV (box);
gdouble start_x, start_y;
GtkFlowBoxChild *child;
+ GtkCssNode *widget_node;
gtk_gesture_drag_get_start_point (gesture, &start_x, &start_y);
{
priv->rubberband_select = TRUE;
priv->rubberband_first = gtk_flow_box_find_child_at_pos (box, start_x, start_y);
+
+ widget_node = gtk_widget_get_css_node (GTK_WIDGET (box));
+ priv->rubberband_node = gtk_css_node_new ();
+ gtk_css_node_set_name (priv->rubberband_node, I_("rubberband"));
+ gtk_css_node_set_parent (priv->rubberband_node, widget_node);
+ gtk_css_node_set_state (priv->rubberband_node, gtk_css_node_get_state (widget_node));
+ g_object_unref (priv->rubberband_node);
/* Grab focus here, so Escape-to-stop-rubberband works */
gtk_flow_box_update_cursor (box, priv->rubberband_first);
priv->rubberband_first = NULL;
priv->rubberband_last = NULL;
+ gtk_css_node_set_parent (priv->rubberband_node, NULL);
+ priv->rubberband_node = NULL;
+
remove_autoscroll (box);
gtk_widget_queue_draw (GTK_WIDGET (box));